local assets = {
	Asset("ANIM", "anim/musha_ovenfire_cold.zip"),
	Asset("ANIM", "anim/musha_ovenfire.zip"),
	Asset("SOUND", "sound/common.fsb")
}

local function common_fn(name)
	local inst = CreateEntity()

	inst.entity:AddTransform()
	inst.entity:AddAnimState()
	inst.entity:AddSoundEmitter()
	inst.entity:AddLight()
	inst.entity:AddNetwork()

	inst.AnimState:SetBank("chiminea_fire")
	inst.AnimState:SetBuild(name)
	inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
	inst.AnimState:SetRayTestOnBB(true)
	inst.AnimState:SetFinalOffset(-1)

	inst:AddTag("fx")

	inst:AddTag("HASHEATER")

	inst.entity:SetPristine()

	if not TheWorld.ismastersim then
		return inst
	end

	inst:AddComponent("heater")
	inst.components.heater.heat = name == "musha_oven_fire" and 70 or -10
	inst.components.heater:SetThermics(false, true)

	inst:AddComponent("firefx")
	inst.components.firefx.levels = {
		{
			anim = "level1",
			sound = "dontstarve/common/campfire",
			radius = 2,
			intensity = .8,
			falloff = .33,
			colour = {255 / 255, 255 / 255, 192 / 255},
			soundintensity = .1
		},
		{
			anim = "level1",
			sound = "dontstarve_DLC001/common/coldfire",
			radius = 2,
			intensity = .8,
			falloff = .33,
			colour = {0, 183 / 255, 1},
			soundintensity = .1
		}
	}

	inst.components.firefx.usedayparamforsound = true
	return inst
end

local function fire()
	return common_fn("musha_ovenfire")
end

local function coldfire()
	return common_fn("musha_ovenfire_cold")
end
return Prefab("musha_ovenfire", fire, assets), Prefab("musha_ovenfire_cold", coldfire, assets)
